#include "led.h"

const unsigned int a = 1500000;/*常量*/
unsigned int b;/*未初始化全局变量*/
unsigned int c = 1500000;/*已初始化全局变量*/
unsigned char d;/*未初始化全局变量*/
unsigned short e;/*未初始化全局变量*/
unsigned int f;/*未初始化全局变量*/
unsigned int g;/*未初始化全局变量*/

void delay(unsigned int num){
	if(num > 0){
		while(num--){
			
		}
	}
}

void test_led(void){
	unsigned int h;/*未初始化局部变量*/
	unsigned int i = 1500000;/*已初始化局部变量*/
	
	c = 150;
	b = 1500000;
	d = 15;
	e = 150;
	f = 1500000;
	g = 1500000;
/*使能GPIO端口C的时钟*/
	RCC_APB2ENR |= 0x00000010;
/*配置GPIO端口C，推挽输出，频率50MHz*/
	GPIOC_CRL = 0x33333333;
/*熄灭LED*/
	GPIOC_ODR |= 0x000000ff;
	while(1){
		delay(a);
		/*点亮LED*/
		GPIOC_ODR &= 0xffffff00;
		delay(b);
		/*熄灭LED*/
		GPIOC_ODR |= 0x000000ff;
		delay(c);
		delay((unsigned int)d);
		delay((unsigned int)e);
		delay(f);
		delay(g);
		delay(h);/*未初始化就使用局部变量，会有警告，变量的值是随机的*/
		delay(i);
	}
	
	return;
}
